<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateOrdersTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
        //总订单表
        Schema::create('orders', function (Blueprint $table) {
            $table->increments('id')->comment('自增id');
            $table->integer('user_id')->default(0)->comment('用户id');
            $table->string('order_num')->unique()->comment('订单编号');
            $table->decimal('m_amount')->default(0)->comment('订单原总额');
            $table->decimal('s_amount')->default(0)->comment('订单实际总额');
            $table->integer('ispay')->default(0)->comment('是否已支付，0：未支付，1：已支付');
            $table->timestamp('paytime')->nullable()->comment('支付时间');
            $table->string('pay_type')->nullable()->comment('支付方式，有weixin、alipay、bank');
            $table->integer('invoice_id')->default(0)->comment('发票信息id');
            $table->string('express_num',100)->nullable()->comment('配送单号');
            $table->string('express')->nullable()->comment('快递公司');
            $table->decimal('express_fee')->default(0)->comment('快递费用');
            $table->timestamp('express_time')->nullable()->comment('发货时间');
            $table->integer('address_id')->default(0)->comment('配送地址id');
            $table->string('note')->nullable()->comment('备注');
            $table->integer('status')->default(0)->comment('订单状态，0：未确认，1：确认订单，2：商家已确认，3：已发货，4:已收货并完成，5:关闭交易，6：退货处理');
            $table->softDeletes();
            $table->timestamps();
        });
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		//
	}

}
